//
//  STSilentLivenessCamera.h
//  TestSTSilentLivenessController
//
//  Created by huoqiuliang on 2019/1/14.
//  Copyright © 2019年 sensetime. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "STSilentLivenessFaceEnumType.h"
@protocol STSilentLivenessCameraDelegate <NSObject>

- (void)didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
               faceOrientaion:(STIDSilentLivenessFaceOrientaion)faceOrientation
            imagePreparewRect:(CGRect)imagePreparewRect
             imagePreviewRect:(CGRect)imagePreviewRect;
- (void)cameraAuthorizationSuccessfully;
- (void)cameraAuthorizationFailed;

@end

@interface STSilentLivenessCamera : NSObject

/**
 初始化相机类

 @param prepareframe 对准框在屏幕上的frame
 @param previewframe 视频预览框在屏幕上的frame
 @return 相机实例对象
 */
- (instancetype)initWithPrepareframe:(CGRect)prepareframe previewframe:(CGRect)previewframe;

@property (nonatomic, weak) id<STSilentLivenessCameraDelegate> delegate;
@property (nonatomic, strong, readonly) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer;

- (void)startRunning;

- (void)stopRunning;

- (CGRect)convertScreenRectByImageRect:(CGRect)imagePreviewRect;

@end
